package com.csxy.six.controller;

import com.csxy.six.R2;
import com.csxy.six.entity.User;
import com.csxy.six.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/teacher")
@Tag(name = "教师管理", description = "教师账号管理接口")
@SecurityRequirement(name = "JWT")
public class TeacherController {

    @Autowired
    private UserService userService;

    @PostMapping("/create")
    @Operation(summary = "创建教师账号", description = "管理员创建新的教师账号")
    public R2<User> createTeacher(
            @RequestBody @Parameter(description = "教师账号信息") User teacher) {
        return userService.createTeacher(teacher);
    }
}